<script setup lang="ts">
import RecentlyLived from "./components/RecentlyLived.vue";
import CourseRanking from "./components/CourseRanking.vue";
import CreativeDesign from "./components/CreativeDesign.vue";
import ProgramLanguage from "./components/ProgramLanguage.vue";
import StoryEvaluation from "./components/StoryEvaluation.vue";

import { useBanner } from "./composables/useBanner";
import { useCategory } from "./composables/useCategory";
const { bannerList } = useBanner();
const { categoryData } = useCategory();
</script>

<template>
  <div class="top-category">
    <div class="container m-top-20">
      <div
        style="display: flex; justify-content: space-between; margin-top: 20px"
      >
        <!-- 轮播图左侧 -->
        <div
          style="
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            background-color: #fff;
            padding: 0 16px 0 17px;
          "
        >
          <div class="title">
            <div class="title_left">创意设计</div>
            <div class="title_right">CAD/3Done/课程名</div>
          </div>
          <div class="title">
            <div class="title_left">编程语言</div>
            <div class="title_right">CAD/3Done/课程名</div>
          </div>
          <div class="title">
            <div class="title_left">模块与电路</div>
            <div class="title_right">CAD/3Done/课程名</div>
          </div>
          <div class="title">
            <div class="title_left">创新思维</div>
            <div class="title_right">创意从0-1开始...</div>
          </div>
          <div style="display: flex; margin: 0 auto">
            <div>更多</div>
            <i class="iconfont icon-xia"></i>
          </div>
        </div>
        <!-- 轮播图 -->
        <div class="home-banner">
          <el-carousel height="222px">
            <el-carousel-item v-for="item in bannerList" :key="item.id">
              <img :src="item.imgUrl" alt="" />
            </el-carousel-item>
          </el-carousel>
        </div>
        <!-- 轮播图右侧 -->
        <div
          style="
            width: 200px;
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            align-items: center;
            background-color: #fff;
          "
        >
          <div>内涵、愿景</div>
          <img
            src="@/assets/images/CloudClassroom/default.png"
            alt=""
            style="width: 68px; height: 68px"
          />
          <div
            style="
              border-radius: 25px;
              padding: 4px 16px;
              width: fit-content;
              background-color: #34b8fa;
              cursor: pointer;
            "
          >
            登录/注册
          </div>
        </div>
      </div>
      <div
        style="
          background-color: #fff;
          padding: 10px 0;
          margin-top: 10px;
          display: flex;
          justify-content: space-around;
          align-items: center;
        "
      >
        <div style="font-weight: Bold">全部105所合作机构</div>
        <img
          src="@/assets/images/CloudClassroom/qiming.png"
          alt=""
          v-for="(item, index) in 7"
          :key="index"
          style="width: 103px; height: 43px"
        />
      </div>

      <!-- 最近直播 -->
      <RecentlyLived />

      <!-- 本周课程排行 -->
      <CourseRanking />

      <!-- 创意设计 -->
      <CreativeDesign />

      <!-- 编程语言 -->
      <ProgramLanguage />
      <!-- 用户故事和评价 -->
      <StoryEvaluation />
    </div>
  </div>
</template>

<style scoped lang="scss">
.top-category {
  h3 {
    font-size: 28px;
    color: #666;
    font-weight: normal;
    text-align: center;
    line-height: 100px;
  }

  .title {
    line-height: 20px;
    display: flex;
    .title_left {
      font-weight: bold;
    }
    .title_right {
      margin-left: 6px;
      font-size: 12px;
      color: #aaaaaa;
    }
  }

  .sub-list {
    margin-top: 20px;
    background-color: #fff;

    ul {
      display: flex;
      padding: 0 32px;
      flex-wrap: wrap;

      li {
        width: 168px;
        height: 160px;

        a {
          text-align: center;
          display: block;
          font-size: 16px;

          img {
            width: 100px;
            height: 100px;
          }

          p {
            line-height: 40px;
          }

          &:hover {
            color: $xtxColor;
          }
        }
      }
    }
  }

  .ref-goods {
    background-color: #fff;
    margin-top: 20px;
    position: relative;

    .head {
      .xtx-more {
        position: absolute;
        top: 20px;
        right: 20px;
      }

      .tag {
        text-align: center;
        color: #999;
        font-size: 20px;
        position: relative;
        top: -20px;
      }
    }

    .body {
      display: flex;
      justify-content: space-around;
      padding: 0 40px 30px;
    }
  }

  .bread-container {
    padding: 25px 0;
  }
}

.home-banner {
  width: 788px;
  height: 222px;
  // margin: 20px auto 0;

  img {
    width: 100%;
    height: 222px;
  }
}
</style>
